/**
 * 
 */
package com.wgo.precise.client.ui.view.editor;

import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
import org.eclipse.ui.forms.widgets.ScrolledForm;

import com.wgo.precise.client.ui.model.facade.ILabelProviderItem;
import com.wgo.precise.client.ui.view.util.ModelPersistable;


/**
 * @author Petter L. H. Eide
 *
 */
public abstract class AbstractFormPage extends FormPage {

	public AbstractFormPage(FormEditor editor, String id, String title) {
		super(editor, id, title);
	}

	protected ILabelProviderItem getModelItem(){
		return ((ModelPersistable) getEditorInput().getPersistable()).getItem();
	}

	protected void updateText() {
		IManagedForm mForm = getManagedForm() ;
		ScrolledForm sForm = mForm.getForm() ;
		ILabelProviderItem item = getModelItem();
		String text = item.getText();
		sForm.setText(text);
		getManagedForm().getForm().setToolTipText(getModelItem().getToolTipText());
	}
	public abstract void refresh() ;

}
